﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using LAVAA.DAL;
using System.ComponentModel.DataAnnotations;

namespace LAVAA.WEB.Models
{
    public class ActivityTypeViewModel
    {

        public ActivityTypeViewModel()
        {

        }
        public ActivityTypeViewModel(ActivityType activityType)
        {
            Id = activityType.Id;
            Name = activityType.Name;
        }

        public Guid Id { get; set; }

        [Required(ErrorMessage = "Obligatoriskt")]
        [Display(Name = "Aktivitetstyp")]
        public string Name { get; set; }
    }

    public static class ActivityTypeExtension
    {
        public static ActivityType ToDAL(this ActivityTypeViewModel vm)
        {
            return new ActivityType() { Id = vm.Id, Name = vm.Name };
        }

        public static ActivityTypeViewModel ToViewModel(this ActivityType vm)
        {
            return new ActivityTypeViewModel() { Id = vm.Id, Name = vm.Name };
        }
    }
}